﻿public class Solution {
    public int Change(int amount, int[] coins)
    {
        int[] dp = new int[amount + 1];
        dp[0] = 1;

        for (int i = 0; i < coins.Length; i++)
        {
            for (int j = coins[i]; j <= amount; j++)
            {
                dp[j] += dp[j - coins[i]];
            }
        }

        return dp[^1];
    }

    public static void Main(string[] args)
    {
        int amount = 5;
        int[] coins = [1, 2, 5];
        Solution solution = new Solution();
        int res = solution.Change(amount, coins);
        Console.WriteLine(res);
    }
}